package com.hzdesk.media.koreabatchmatvector.logic.persenter;


import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.widget.ImageView;

import com.hzdesk.media.koreabatchmatvector.logic.contract.BoundCloudServiceContract;
import com.hzdesk.media.koreabatchmatvector.utils.MacUtil;
import com.hzdesk.media.koreabatchmatvector.utils.ZXingUtils;

/**
 * Created by Administrator on 2018/7/10.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 */

public class BoundCloudServicePersenter implements BoundCloudServiceContract.IBoundCloudServicePersenter {
    private BoundCloudServiceContract.IBoundCloudServiceView mIBoundCloudServiceView;

    public BoundCloudServicePersenter(BoundCloudServiceContract.IBoundCloudServiceView mIBoundCloudServiceView) {
        this.mIBoundCloudServiceView = mIBoundCloudServiceView;
    }

    @Override
    public void onclickedBack() {
        mIBoundCloudServiceView.toFinshPager();
    }

    @Override
    public void initDate(Context mContext, ImageView mImageView) {
        int i = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
        int j = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
        mImageView.measure(i, j);
        String macAddress = MacUtil.getMacAddress(mContext);
        String mac = "1:"+macAddress;
        Bitmap bitmap = ZXingUtils.createQRImage(mac, mImageView.getMeasuredWidth(), mImageView.getMeasuredHeight());
        mImageView.setImageBitmap(bitmap);
    }
}
